#include "qmainsettings.h"

QMainSettings* QMainSettings::m_instance = NULL;

QMainSettings::QMainSettings():
QSettings(SETTINGS_FILE_NAME,QSettings::IniFormat)
{
	QFileInfo file(SETTINGS_FILE_NAME);
	
	if(!file.exists())
		reset();
}


QMainSettings::~QMainSettings(void)
{
}

QMainSettings* QMainSettings::instance()
{
	if(!m_instance)
	{
		m_instance = new QMainSettings();
	}
	return m_instance;
}

void QMainSettings::destroy()
{
	if(m_instance)
	{
		delete m_instance;
		m_instance = NULL;
	}
}


void QMainSettings::reset()
{
	setValue(SETTINGS_DESIGNATORS_EXCLUSION_NO_PART,SETTINGS_DEFAULT_EXCLUSION_NO_PART);
	setValue(SETTINGS_DESIGNATORS_EXCLUSION_COMMON_PART,SETTINGS_DEFAULT_EXCLUSION_COMMON_PART);
	setValue(SETTINGS_BDD_NAME,SETTINGS_BDD_NAME_DEFAULT);
}